/*
 * Copyright (c) 2006, 2023, webrx.cn All rights reserved.
 *
 */

package org.abc;

import java.util.Random;
import java.util.UUID;

/**
 * <p>Project: jse2303 - Rand1
 * <p>Powered by webrx On 2023-07-10 17:15:34
 * <p>描述：<p>
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Rand1 {
    public static void main(String[] args) {
        //1 Math类有一人静态方法，返回1-0 随机小数 double
        for (int i = 0; i < 5; i++) {
            System.out.println(Math.random());
        }

        Random rand = new Random();
        System.out.println("-".repeat(rand.nextInt(10, 50)));
        //2 随机类java.util.Random 有种子值设置，随机非常方便
        for (int i = 0; i < 5; i++) {
            System.out.println(rand.nextDouble());
        }

        System.out.println("-".repeat(rand.nextInt(10, 50)));
        //3 uuid 全球唯一随机字符串，一般用于分布式系统开发中。36位随机字符串
        System.out.println("3516a7c9-c80b-4184-aab2-fb844602fe77".length());
        for (int i = 0; i < 5; i++) {
            System.out.println(UUID.randomUUID());
        }

    }
}
